module ListHelper
  def save(params, good)
    CartGood.find_by_name(params[:name]) == nil ? CartGood.new(good).save : CartGood.find_by_name(params[:name]).update(:count => CartGood.find_by_name(params[:name])[:count].to_i + 1)
  end

  def delete_good_info(i)
    i.destroy if i[:count] == 0
  end
end
